package me.kennylee.mobile.sms.code;

import lombok.Data;
import lombok.RequiredArgsConstructor;

/**
 * <p> 短信的回调信息 </p>
 * <p>Created on 31/1/2018.</p>
 *
 * @author kennylee
 */
@Data
@RequiredArgsConstructor(staticName = "of")
public class SmsResponse {
    private boolean isSuccess = Boolean.FALSE;
    private String message;
    private Object detail;

    public static SmsResponse error() {
        return SmsResponse.of();
    }

    public static SmsResponse error(String message) {
        SmsResponse o = SmsResponse.of();
        o.setMessage(message);
        return o;
    }

    public static SmsResponse error(String message, Object detail) {
        SmsResponse o = SmsResponse.of();
        o.setMessage(message);
        o.setDetail(detail);
        return o;
    }

    public static SmsResponse success() {
        SmsResponse o = SmsResponse.of();
        o.setSuccess(Boolean.TRUE);
        return o;
    }

    public static SmsResponse success(String message) {
        SmsResponse o = SmsResponse.of();
        o.setSuccess(Boolean.TRUE);
        o.setMessage(message);
        return o;
    }

    public static SmsResponse success(String message, Object detail) {
        SmsResponse o = SmsResponse.of();
        o.setSuccess(Boolean.TRUE);
        o.setMessage(message);
        o.setDetail(detail);
        return o;
    }
}
